%% Author: kevin.jingqiu
%% Created: May 29, 2009
%% Description: TODO: Add description to p3
-module(p3).

%%
%% Include files
%%

%%
%% Exported Functions
%%
-export([solve/0]).

%%
%% API Functions
%%
solve() -> p3(600851475143).



%%
%% Local Functions
%%

p3(X) -> get_first_prime(mylib:factor(X)).

get_first_prime([H|T]) ->
	case mylib:is_prime(H) of
		true -> H;
		false -> get_first_prime(T)
	end;
get_first_prime([]) ->
	ok.
